export class Dialog {

    static DialogType = {
      Error:"danger",
      Success:"success",
      Info:"info",
      Question:"primary",
      Warn:"warning"
    }

    public type:string = "default";
    public title:string;
    public content:string;
    public cancelBtn:string="取消";
    public okBtn:string="确定";
    public cancelBtnFun:Function;
    public okBtnFun:Function;
    public closeFun:Function;
    public showOkBtn:boolean = true;
    public showCancelBtn:boolean=false;
    public isModal: boolean = false;

    mergeFrom (o:Dialog){
      this.type = this.type ? this.type : o.type;
      this.cancelBtn = this.cancelBtn ? this.cancelBtn : o.cancelBtn;
      this.okBtn = this.okBtn ? this.okBtn : o.okBtn;
      return this;
    }

    wrap(){
      let _title;
      switch (this.type){
        case Dialog.DialogType.Error:
          _title= "错误";
          break;
        case Dialog.DialogType.Success:
          _title="成功";
          break;
        case Dialog.DialogType.Info:
          _title="信息";
          break;
        case Dialog.DialogType.Question:
          _title="问题";
          break;
        case Dialog.DialogType.Warn:
          _title="警告";
          break;
        default:
          break;
      }
      this.title= this.title ? this.title : _title;
      return this;
    }

}

